package com.hps.boot.shiro.controller;

import com.hps.boot.shiro.model.Order;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.apache.shiro.authz.annotation.RequiresRoles;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author heps
 * @since 2020/6/9 18:35
 */
@RestController
@RequestMapping("/api/order")
public class OrderController {

  @RequiresRoles("admin")
  @GetMapping("/{id}")
  public Order order(@PathVariable("id") Long id) {
    Order order = new Order();
    order.setId(id);
    order.setDesc("Y9000X");
    return order;
  }
}
